// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyParallelCoordinatesAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>
#include <ColorAttribute.h>
#include <ColorAttribute.h>

// ****************************************************************************
// Module: PyParallelCoordinatesAttributes
//
// Purpose:
//   This class contains the plot attributes for the ParallelCoordinates plot.
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a ParallelCoordinatesAttributes.
//
struct ParallelCoordinatesAttributesObject
{
    PyObject_HEAD
    ParallelCoordinatesAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewParallelCoordinatesAttributes(int);
std::string
PyParallelCoordinatesAttributes_ToString(const ParallelCoordinatesAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    {   const stringVector &scalarAxisNames = atts->GetScalarAxisNames();
        snprintf(tmpStr, 1000, "%sscalarAxisNames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < scalarAxisNames.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", scalarAxisNames[i].c_str());
            str += tmpStr;
            if(i < scalarAxisNames.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const stringVector &visualAxisNames = atts->GetVisualAxisNames();
        snprintf(tmpStr, 1000, "%svisualAxisNames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < visualAxisNames.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", visualAxisNames[i].c_str());
            str += tmpStr;
            if(i < visualAxisNames.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &extentMinima = atts->GetExtentMinima();
        snprintf(tmpStr, 1000, "%sextentMinima = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < extentMinima.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", extentMinima[i]);
            str += tmpStr;
            if(i < extentMinima.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &extentMaxima = atts->GetExtentMaxima();
        snprintf(tmpStr, 1000, "%sextentMaxima = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < extentMaxima.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", extentMaxima[i]);
            str += tmpStr;
            if(i < extentMaxima.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    if(atts->GetDrawLines())
        snprintf(tmpStr, 1000, "%sdrawLines = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sdrawLines = 0\n", prefix);
    str += tmpStr;
    const unsigned char *linesColor = atts->GetLinesColor().GetColor();
    snprintf(tmpStr, 1000, "%slinesColor = (%d, %d, %d, %d)\n", prefix, int(linesColor[0]), int(linesColor[1]), int(linesColor[2]), int(linesColor[3]));
    str += tmpStr;
    if(atts->GetDrawContext())
        snprintf(tmpStr, 1000, "%sdrawContext = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sdrawContext = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%scontextGamma = %g\n", prefix, atts->GetContextGamma());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%scontextNumPartitions = %d\n", prefix, atts->GetContextNumPartitions());
    str += tmpStr;
    const unsigned char *contextColor = atts->GetContextColor().GetColor();
    snprintf(tmpStr, 1000, "%scontextColor = (%d, %d, %d, %d)\n", prefix, int(contextColor[0]), int(contextColor[1]), int(contextColor[2]), int(contextColor[3]));
    str += tmpStr;
    if(atts->GetDrawLinesOnlyIfExtentsOn())
        snprintf(tmpStr, 1000, "%sdrawLinesOnlyIfExtentsOn = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sdrawLinesOnlyIfExtentsOn = 0\n", prefix);
    str += tmpStr;
    if(atts->GetUnifyAxisExtents())
        snprintf(tmpStr, 1000, "%sunifyAxisExtents = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sunifyAxisExtents = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%slinesNumPartitions = %d\n", prefix, atts->GetLinesNumPartitions());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sfocusGamma = %g\n", prefix, atts->GetFocusGamma());
    str += tmpStr;
    const char *drawFocusAs_names = "IndividualLines, BinsOfConstantColor, BinsColoredByPopulation";
    switch (atts->GetDrawFocusAs())
    {
      case ParallelCoordinatesAttributes::IndividualLines:
          snprintf(tmpStr, 1000, "%sdrawFocusAs = %sIndividualLines  # %s\n", prefix, prefix, drawFocusAs_names);
          str += tmpStr;
          break;
      case ParallelCoordinatesAttributes::BinsOfConstantColor:
          snprintf(tmpStr, 1000, "%sdrawFocusAs = %sBinsOfConstantColor  # %s\n", prefix, prefix, drawFocusAs_names);
          str += tmpStr;
          break;
      case ParallelCoordinatesAttributes::BinsColoredByPopulation:
          snprintf(tmpStr, 1000, "%sdrawFocusAs = %sBinsColoredByPopulation  # %s\n", prefix, prefix, drawFocusAs_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    return str;
}

static PyObject *
ParallelCoordinatesAttributes_Notify(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetScalarAxisNames(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetScalarAxisNames() = vec;
    // Mark the scalarAxisNames in the object as modified.
    obj->data->SelectScalarAxisNames();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetScalarAxisNames(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the scalarAxisNames.
    const stringVector &scalarAxisNames = obj->data->GetScalarAxisNames();
    PyObject *retval = PyTuple_New(scalarAxisNames.size());
    for(size_t i = 0; i < scalarAxisNames.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(scalarAxisNames[i].c_str()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetVisualAxisNames(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetVisualAxisNames() = vec;
    // Mark the visualAxisNames in the object as modified.
    obj->data->SelectVisualAxisNames();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetVisualAxisNames(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the visualAxisNames.
    const stringVector &visualAxisNames = obj->data->GetVisualAxisNames();
    PyObject *retval = PyTuple_New(visualAxisNames.size());
    for(size_t i = 0; i < visualAxisNames.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(visualAxisNames[i].c_str()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetExtentMinima(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetExtentMinima() = vec;
    // Mark the extentMinima in the object as modified.
    obj->data->SelectExtentMinima();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetExtentMinima(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the extentMinima.
    const doubleVector &extentMinima = obj->data->GetExtentMinima();
    PyObject *retval = PyTuple_New(extentMinima.size());
    for(size_t i = 0; i < extentMinima.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(extentMinima[i]));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetExtentMaxima(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetExtentMaxima() = vec;
    // Mark the extentMaxima in the object as modified.
    obj->data->SelectExtentMaxima();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetExtentMaxima(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the extentMaxima.
    const doubleVector &extentMaxima = obj->data->GetExtentMaxima();
    PyObject *retval = PyTuple_New(extentMaxima.size());
    for(size_t i = 0; i < extentMaxima.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(extentMaxima[i]));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetDrawLines(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the drawLines in the object.
    obj->data->SetDrawLines(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetDrawLines(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetDrawLines()?1L:0L);
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetLinesColor(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    int c[4];
    if(!PyArg_ParseTuple(args, "iiii", &c[0], &c[1], &c[2], &c[3]))
    {
        c[3] = 255;
        if(!PyArg_ParseTuple(args, "iii", &c[0], &c[1], &c[2]))
        {
            double dr, dg, db, da;
            if(PyArg_ParseTuple(args, "dddd", &dr, &dg, &db, &da))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = int(da);
            }
            else if(PyArg_ParseTuple(args, "ddd", &dr, &dg, &db))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = 255;
            }
            else
            {
                PyObject *tuple = NULL;
                if(!PyArg_ParseTuple(args, "O", &tuple))
                    return NULL;

                if(!PyTuple_Check(tuple))
                    return NULL;

                // Make sure that the tuple is the right size.
                if(PyTuple_Size(tuple) < 3 || PyTuple_Size(tuple) > 4)
                    return NULL;

                // Make sure that all elements in the tuple are ints.
                for(int i = 0; i < PyTuple_Size(tuple); ++i)
                {
                    PyObject *item = PyTuple_GET_ITEM(tuple, i);
                    if(PyInt_Check(item))
                        c[i] = int(PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, i)));
                    else if(PyFloat_Check(item))
                        c[i] = int(PyFloat_AS_DOUBLE(PyTuple_GET_ITEM(tuple, i)));
                    else
                        return NULL;
                }
            }
        }
        PyErr_Clear();
    }

    // Set the linesColor in the object.
    ColorAttribute ca(c[0], c[1], c[2], c[3]);
    obj->data->SetLinesColor(ca);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetLinesColor(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the linesColor.
    PyObject *retval = PyTuple_New(4);
    const unsigned char *linesColor = obj->data->GetLinesColor().GetColor();
    PyTuple_SET_ITEM(retval, 0, PyInt_FromLong(long(linesColor[0])));
    PyTuple_SET_ITEM(retval, 1, PyInt_FromLong(long(linesColor[1])));
    PyTuple_SET_ITEM(retval, 2, PyInt_FromLong(long(linesColor[2])));
    PyTuple_SET_ITEM(retval, 3, PyInt_FromLong(long(linesColor[3])));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetDrawContext(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the drawContext in the object.
    obj->data->SetDrawContext(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetDrawContext(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetDrawContext()?1L:0L);
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetContextGamma(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the contextGamma in the object.
    obj->data->SetContextGamma(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetContextGamma(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetContextGamma()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetContextNumPartitions(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the contextNumPartitions in the object.
    obj->data->SetContextNumPartitions(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetContextNumPartitions(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetContextNumPartitions()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetContextColor(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    int c[4];
    if(!PyArg_ParseTuple(args, "iiii", &c[0], &c[1], &c[2], &c[3]))
    {
        c[3] = 255;
        if(!PyArg_ParseTuple(args, "iii", &c[0], &c[1], &c[2]))
        {
            double dr, dg, db, da;
            if(PyArg_ParseTuple(args, "dddd", &dr, &dg, &db, &da))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = int(da);
            }
            else if(PyArg_ParseTuple(args, "ddd", &dr, &dg, &db))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = 255;
            }
            else
            {
                PyObject *tuple = NULL;
                if(!PyArg_ParseTuple(args, "O", &tuple))
                    return NULL;

                if(!PyTuple_Check(tuple))
                    return NULL;

                // Make sure that the tuple is the right size.
                if(PyTuple_Size(tuple) < 3 || PyTuple_Size(tuple) > 4)
                    return NULL;

                // Make sure that all elements in the tuple are ints.
                for(int i = 0; i < PyTuple_Size(tuple); ++i)
                {
                    PyObject *item = PyTuple_GET_ITEM(tuple, i);
                    if(PyInt_Check(item))
                        c[i] = int(PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, i)));
                    else if(PyFloat_Check(item))
                        c[i] = int(PyFloat_AS_DOUBLE(PyTuple_GET_ITEM(tuple, i)));
                    else
                        return NULL;
                }
            }
        }
        PyErr_Clear();
    }

    // Set the contextColor in the object.
    ColorAttribute ca(c[0], c[1], c[2], c[3]);
    obj->data->SetContextColor(ca);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetContextColor(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the contextColor.
    PyObject *retval = PyTuple_New(4);
    const unsigned char *contextColor = obj->data->GetContextColor().GetColor();
    PyTuple_SET_ITEM(retval, 0, PyInt_FromLong(long(contextColor[0])));
    PyTuple_SET_ITEM(retval, 1, PyInt_FromLong(long(contextColor[1])));
    PyTuple_SET_ITEM(retval, 2, PyInt_FromLong(long(contextColor[2])));
    PyTuple_SET_ITEM(retval, 3, PyInt_FromLong(long(contextColor[3])));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetDrawLinesOnlyIfExtentsOn(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the drawLinesOnlyIfExtentsOn in the object.
    obj->data->SetDrawLinesOnlyIfExtentsOn(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetDrawLinesOnlyIfExtentsOn(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetDrawLinesOnlyIfExtentsOn()?1L:0L);
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetUnifyAxisExtents(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the unifyAxisExtents in the object.
    obj->data->SetUnifyAxisExtents(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetUnifyAxisExtents(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetUnifyAxisExtents()?1L:0L);
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetLinesNumPartitions(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the linesNumPartitions in the object.
    obj->data->SetLinesNumPartitions(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetLinesNumPartitions(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetLinesNumPartitions()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetFocusGamma(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    float cval = float(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ float");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ float");
    }

    Py_XDECREF(packaged_args);

    // Set the focusGamma in the object.
    obj->data->SetFocusGamma(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetFocusGamma(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(double(obj->data->GetFocusGamma()));
    return retval;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_SetDrawFocusAs(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 3)
    {
        std::stringstream ss;
        ss << "An invalid drawFocusAs value was given." << std::endl;
        ss << "Valid values are in the range [0,2]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " IndividualLines";
        ss << ", BinsOfConstantColor";
        ss << ", BinsColoredByPopulation";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the drawFocusAs in the object.
    obj->data->SetDrawFocusAs(ParallelCoordinatesAttributes::FocusRendering(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ParallelCoordinatesAttributes_GetDrawFocusAs(PyObject *self, PyObject *args)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetDrawFocusAs()));
    return retval;
}



PyMethodDef PyParallelCoordinatesAttributes_methods[PARALLELCOORDINATESATTRIBUTES_NMETH] = {
    {"Notify", ParallelCoordinatesAttributes_Notify, METH_VARARGS},
    {"SetScalarAxisNames", ParallelCoordinatesAttributes_SetScalarAxisNames, METH_VARARGS},
    {"GetScalarAxisNames", ParallelCoordinatesAttributes_GetScalarAxisNames, METH_VARARGS},
    {"SetVisualAxisNames", ParallelCoordinatesAttributes_SetVisualAxisNames, METH_VARARGS},
    {"GetVisualAxisNames", ParallelCoordinatesAttributes_GetVisualAxisNames, METH_VARARGS},
    {"SetExtentMinima", ParallelCoordinatesAttributes_SetExtentMinima, METH_VARARGS},
    {"GetExtentMinima", ParallelCoordinatesAttributes_GetExtentMinima, METH_VARARGS},
    {"SetExtentMaxima", ParallelCoordinatesAttributes_SetExtentMaxima, METH_VARARGS},
    {"GetExtentMaxima", ParallelCoordinatesAttributes_GetExtentMaxima, METH_VARARGS},
    {"SetDrawLines", ParallelCoordinatesAttributes_SetDrawLines, METH_VARARGS},
    {"GetDrawLines", ParallelCoordinatesAttributes_GetDrawLines, METH_VARARGS},
    {"SetLinesColor", ParallelCoordinatesAttributes_SetLinesColor, METH_VARARGS},
    {"GetLinesColor", ParallelCoordinatesAttributes_GetLinesColor, METH_VARARGS},
    {"SetDrawContext", ParallelCoordinatesAttributes_SetDrawContext, METH_VARARGS},
    {"GetDrawContext", ParallelCoordinatesAttributes_GetDrawContext, METH_VARARGS},
    {"SetContextGamma", ParallelCoordinatesAttributes_SetContextGamma, METH_VARARGS},
    {"GetContextGamma", ParallelCoordinatesAttributes_GetContextGamma, METH_VARARGS},
    {"SetContextNumPartitions", ParallelCoordinatesAttributes_SetContextNumPartitions, METH_VARARGS},
    {"GetContextNumPartitions", ParallelCoordinatesAttributes_GetContextNumPartitions, METH_VARARGS},
    {"SetContextColor", ParallelCoordinatesAttributes_SetContextColor, METH_VARARGS},
    {"GetContextColor", ParallelCoordinatesAttributes_GetContextColor, METH_VARARGS},
    {"SetDrawLinesOnlyIfExtentsOn", ParallelCoordinatesAttributes_SetDrawLinesOnlyIfExtentsOn, METH_VARARGS},
    {"GetDrawLinesOnlyIfExtentsOn", ParallelCoordinatesAttributes_GetDrawLinesOnlyIfExtentsOn, METH_VARARGS},
    {"SetUnifyAxisExtents", ParallelCoordinatesAttributes_SetUnifyAxisExtents, METH_VARARGS},
    {"GetUnifyAxisExtents", ParallelCoordinatesAttributes_GetUnifyAxisExtents, METH_VARARGS},
    {"SetLinesNumPartitions", ParallelCoordinatesAttributes_SetLinesNumPartitions, METH_VARARGS},
    {"GetLinesNumPartitions", ParallelCoordinatesAttributes_GetLinesNumPartitions, METH_VARARGS},
    {"SetFocusGamma", ParallelCoordinatesAttributes_SetFocusGamma, METH_VARARGS},
    {"GetFocusGamma", ParallelCoordinatesAttributes_GetFocusGamma, METH_VARARGS},
    {"SetDrawFocusAs", ParallelCoordinatesAttributes_SetDrawFocusAs, METH_VARARGS},
    {"GetDrawFocusAs", ParallelCoordinatesAttributes_GetDrawFocusAs, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
ParallelCoordinatesAttributes_dealloc(PyObject *v)
{
   ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *ParallelCoordinatesAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyParallelCoordinatesAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "scalarAxisNames") == 0)
        return ParallelCoordinatesAttributes_GetScalarAxisNames(self, NULL);
    if(strcmp(name, "visualAxisNames") == 0)
        return ParallelCoordinatesAttributes_GetVisualAxisNames(self, NULL);
    if(strcmp(name, "extentMinima") == 0)
        return ParallelCoordinatesAttributes_GetExtentMinima(self, NULL);
    if(strcmp(name, "extentMaxima") == 0)
        return ParallelCoordinatesAttributes_GetExtentMaxima(self, NULL);
    if(strcmp(name, "drawLines") == 0)
        return ParallelCoordinatesAttributes_GetDrawLines(self, NULL);
    if(strcmp(name, "linesColor") == 0)
        return ParallelCoordinatesAttributes_GetLinesColor(self, NULL);
    if(strcmp(name, "drawContext") == 0)
        return ParallelCoordinatesAttributes_GetDrawContext(self, NULL);
    if(strcmp(name, "contextGamma") == 0)
        return ParallelCoordinatesAttributes_GetContextGamma(self, NULL);
    if(strcmp(name, "contextNumPartitions") == 0)
        return ParallelCoordinatesAttributes_GetContextNumPartitions(self, NULL);
    if(strcmp(name, "contextColor") == 0)
        return ParallelCoordinatesAttributes_GetContextColor(self, NULL);
    if(strcmp(name, "drawLinesOnlyIfExtentsOn") == 0)
        return ParallelCoordinatesAttributes_GetDrawLinesOnlyIfExtentsOn(self, NULL);
    if(strcmp(name, "unifyAxisExtents") == 0)
        return ParallelCoordinatesAttributes_GetUnifyAxisExtents(self, NULL);
    if(strcmp(name, "linesNumPartitions") == 0)
        return ParallelCoordinatesAttributes_GetLinesNumPartitions(self, NULL);
    if(strcmp(name, "focusGamma") == 0)
        return ParallelCoordinatesAttributes_GetFocusGamma(self, NULL);
    if(strcmp(name, "drawFocusAs") == 0)
        return ParallelCoordinatesAttributes_GetDrawFocusAs(self, NULL);
    if(strcmp(name, "IndividualLines") == 0)
        return PyInt_FromLong(long(ParallelCoordinatesAttributes::IndividualLines));
    if(strcmp(name, "BinsOfConstantColor") == 0)
        return PyInt_FromLong(long(ParallelCoordinatesAttributes::BinsOfConstantColor));
    if(strcmp(name, "BinsColoredByPopulation") == 0)
        return PyInt_FromLong(long(ParallelCoordinatesAttributes::BinsColoredByPopulation));



    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyParallelCoordinatesAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyParallelCoordinatesAttributes_methods[i].ml_name),
                PyString_FromString(PyParallelCoordinatesAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyParallelCoordinatesAttributes_methods, self, name);
}

int
PyParallelCoordinatesAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "scalarAxisNames") == 0)
        obj = ParallelCoordinatesAttributes_SetScalarAxisNames(self, args);
    else if(strcmp(name, "visualAxisNames") == 0)
        obj = ParallelCoordinatesAttributes_SetVisualAxisNames(self, args);
    else if(strcmp(name, "extentMinima") == 0)
        obj = ParallelCoordinatesAttributes_SetExtentMinima(self, args);
    else if(strcmp(name, "extentMaxima") == 0)
        obj = ParallelCoordinatesAttributes_SetExtentMaxima(self, args);
    else if(strcmp(name, "drawLines") == 0)
        obj = ParallelCoordinatesAttributes_SetDrawLines(self, args);
    else if(strcmp(name, "linesColor") == 0)
        obj = ParallelCoordinatesAttributes_SetLinesColor(self, args);
    else if(strcmp(name, "drawContext") == 0)
        obj = ParallelCoordinatesAttributes_SetDrawContext(self, args);
    else if(strcmp(name, "contextGamma") == 0)
        obj = ParallelCoordinatesAttributes_SetContextGamma(self, args);
    else if(strcmp(name, "contextNumPartitions") == 0)
        obj = ParallelCoordinatesAttributes_SetContextNumPartitions(self, args);
    else if(strcmp(name, "contextColor") == 0)
        obj = ParallelCoordinatesAttributes_SetContextColor(self, args);
    else if(strcmp(name, "drawLinesOnlyIfExtentsOn") == 0)
        obj = ParallelCoordinatesAttributes_SetDrawLinesOnlyIfExtentsOn(self, args);
    else if(strcmp(name, "unifyAxisExtents") == 0)
        obj = ParallelCoordinatesAttributes_SetUnifyAxisExtents(self, args);
    else if(strcmp(name, "linesNumPartitions") == 0)
        obj = ParallelCoordinatesAttributes_SetLinesNumPartitions(self, args);
    else if(strcmp(name, "focusGamma") == 0)
        obj = ParallelCoordinatesAttributes_SetFocusGamma(self, args);
    else if(strcmp(name, "drawFocusAs") == 0)
        obj = ParallelCoordinatesAttributes_SetDrawFocusAs(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
ParallelCoordinatesAttributes_print(PyObject *v, FILE *fp, int flags)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)v;
    fprintf(fp, "%s", PyParallelCoordinatesAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
ParallelCoordinatesAttributes_str(PyObject *v)
{
    ParallelCoordinatesAttributesObject *obj = (ParallelCoordinatesAttributesObject *)v;
    return PyString_FromString(PyParallelCoordinatesAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *ParallelCoordinatesAttributes_Purpose = "This class contains the plot attributes for the ParallelCoordinates plot.";
#else
static char *ParallelCoordinatesAttributes_Purpose = "This class contains the plot attributes for the ParallelCoordinates plot.";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(ParallelCoordinatesAttributesType,         \
                  "ParallelCoordinatesAttributes",           \
                  ParallelCoordinatesAttributesObject,       \
                  ParallelCoordinatesAttributes_dealloc,     \
                  ParallelCoordinatesAttributes_print,       \
                  PyParallelCoordinatesAttributes_getattr,   \
                  PyParallelCoordinatesAttributes_setattr,   \
                  ParallelCoordinatesAttributes_str,         \
                  ParallelCoordinatesAttributes_Purpose,     \
                  ParallelCoordinatesAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
ParallelCoordinatesAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &ParallelCoordinatesAttributesType
         || Py_TYPE(other) != &ParallelCoordinatesAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    ParallelCoordinatesAttributes *a = ((ParallelCoordinatesAttributesObject *)self)->data;
    ParallelCoordinatesAttributes *b = ((ParallelCoordinatesAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static ParallelCoordinatesAttributes *defaultAtts = 0;
static ParallelCoordinatesAttributes *currentAtts = 0;

static PyObject *
NewParallelCoordinatesAttributes(int useCurrent)
{
    ParallelCoordinatesAttributesObject *newObject;
    newObject = PyObject_NEW(ParallelCoordinatesAttributesObject, &ParallelCoordinatesAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new ParallelCoordinatesAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new ParallelCoordinatesAttributes(*defaultAtts);
    else
        newObject->data = new ParallelCoordinatesAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapParallelCoordinatesAttributes(const ParallelCoordinatesAttributes *attr)
{
    ParallelCoordinatesAttributesObject *newObject;
    newObject = PyObject_NEW(ParallelCoordinatesAttributesObject, &ParallelCoordinatesAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (ParallelCoordinatesAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
ParallelCoordinatesAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewParallelCoordinatesAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef ParallelCoordinatesAttributesMethods[] = {
    {"ParallelCoordinatesAttributes", ParallelCoordinatesAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *ParallelCoordinatesAttributesObserver = 0;

std::string
PyParallelCoordinatesAttributes_GetLogString()
{
    std::string s("ParallelCoordinatesAtts = ParallelCoordinatesAttributes()\n");
    if(currentAtts != 0)
        s += PyParallelCoordinatesAttributes_ToString(currentAtts, "ParallelCoordinatesAtts.", true);
    return s;
}

static void
PyParallelCoordinatesAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("ParallelCoordinatesAtts = ParallelCoordinatesAttributes()\n");
        s += PyParallelCoordinatesAttributes_ToString(currentAtts, "ParallelCoordinatesAtts.", true);
        cb(s);
    }
}

void
PyParallelCoordinatesAttributes_StartUp(ParallelCoordinatesAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyParallelCoordinatesAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(ParallelCoordinatesAttributesObserver == 0)
    {
        ParallelCoordinatesAttributesObserver = new ObserverToCallback(subj,
            PyParallelCoordinatesAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyParallelCoordinatesAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete ParallelCoordinatesAttributesObserver;
    ParallelCoordinatesAttributesObserver = 0;
}

PyMethodDef *
PyParallelCoordinatesAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return ParallelCoordinatesAttributesMethods;
}

bool
PyParallelCoordinatesAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &ParallelCoordinatesAttributesType);
}

ParallelCoordinatesAttributes *
PyParallelCoordinatesAttributes_FromPyObject(PyObject *obj)
{
    ParallelCoordinatesAttributesObject *obj2 = (ParallelCoordinatesAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyParallelCoordinatesAttributes_New()
{
    return NewParallelCoordinatesAttributes(0);
}

PyObject *
PyParallelCoordinatesAttributes_Wrap(const ParallelCoordinatesAttributes *attr)
{
    return WrapParallelCoordinatesAttributes(attr);
}

void
PyParallelCoordinatesAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    ParallelCoordinatesAttributesObject *obj2 = (ParallelCoordinatesAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyParallelCoordinatesAttributes_SetDefaults(const ParallelCoordinatesAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new ParallelCoordinatesAttributes(*atts);
}

